Repository navigation
fix: keep replies to flagged comments, page domain feeds fully, and four smaller fixes - #318
Merged
Merged
Conversation
Algolia's comment search leaves out flagged and deleted comments but returns their replies, and buildCommentTree dropped any reply whose parent wasn't in the results, on the premise that HN hides the subtree under a dead comment. It doesn't: HN shows the flagged comment as a [flagged] row and keeps its replies, collapsed. Story 50299427 had 11 comments and showed 6; 5 of the top 14 stories were missing replies, including moderator replies. The tree now reads each missing parent from Firebase, and its parent when that is missing too, and puts it in the thread. A flagged comment shows its author, time and [flagged], as on HN. Firebase still has the original text of older killed comments (2018 and before in the ones checked), so that text is replaced. A deleted one shows as a [deleted] row through a new `deleted` flag on Comment. Replies whose parent Firebase doesn't have either are still dropped. The batched Firebase read in fetchKidsOrdering moves to a shared readItemsBatched, and a placeholder's kids order comes with it, so its replies keep HN's order without a second read.
A domain feed is a query search on the URL, and Algolia can stop counting a query early: for dev.to it reports nbHits 150 with exhaustiveNbHits false, returns 3 full pages of 50, and nothing past them. nextAlgoliaPage only started over from the oldest hit when nbHits went past the 1,000-hit cap, so /from/dev.to ended after 147 stories from 2021 while a search from the oldest one finds about 6,500 more. It now also starts over when the count is an estimate and the last page came back full. A short page still ends the feed.
The comment swiper's panels come from parent.kids in Firebase, which lists flagged and deleted comments, and each panel loads from Algolia's /items, which 404s them. Swiping onto one showed "Failed to load comment" with a Retry that could never work. On the largest current thread, 35 of 243 top-level comments are flagged or deleted, and every story checked had some. A permalink to one failed the same way. fetchAlgoliaItem now throws NotFoundError on a 404, and the comment pages load through a new fetchCommentItem, which reads a comment Algolia doesn't have from Firebase and its live replies from Algolia. A flagged comment shows its author and [flagged] with its replies, as on HN, even when Firebase still has its original text. On a phone a deleted one shows the existing "Comment deleted" state; on desktop it shows [deleted] where the author goes, with its replies, instead of "unknown" over an empty body. Other Algolia errors still show the error and its Retry. The desktop page first shows the copy of the comment it already read from Firebase, and keeps it if its own request fails, so that copy shows [flagged] too.
…er one A restore or Back mounts the swipe viewer on index 0 and jumps to its story in a layout effect, before paint. The dwell effect for index 0 still ran, so the top story got hidden for 12 hours without being seen.
therealsama
force-pushed
the
fix/comment-gaps-domain-paging-and-view-marks
branch
from
November 2, 2026 02:11
43b6dab to
e47b2f8
Compare
therealsama
enabled auto-merge
November 2, 2026 09:10
kplachkov
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes six bugs. Each new test that checks a fix fails on the unfixed code.
Bug fixes
buildCommentTreedropped those replies as orphans. The thread now reads the missing parents (and their parents, when also missing) from Firebase. It shows them the way HN does: a[flagged]row with author and time, or a[deleted]row, with the replies under it. Firebase still has the text of older killed comments (2018 and before in the ones checked), so a killed comment always shows[flagged], as HN does. The extra Firebase reads only happen when a parent is missing. They also bring back the few live comments that both Algolia sources miss, when those have replies. On story 50299427, the thread now shows all 14 comments HN shows, in HN's order. Before, a flagged comment and its 5 replies were missing.nbHits(exhaustiveNbHits: false). For dev.to it reported 150 hits over 3 pages, so the feed ended after about 150 stories. When the count is an estimate and the last page was full, paging now continues from the oldest story so far, the same way it already gets past the 1,000-hit cap./from/dev.tonow keeps loading past 290 stories./itemsreturns 404 for those. The comment view now falls back to Firebase for the comment and gets each reply from Algolia, through a newfetchCommentItem(). Other Algolia errors are still errors.fetchAlgoliaItemnow throwsNotFoundErroron a 404. The desktop page of a deleted comment shows[deleted]where the author goes, instead of "unknown" over an empty body. The desktop page first shows the copy of the comment it already read from Firebase. That copy now says[flagged]too, so a killed comment's text doesn't show while the page loads or after its request fails.formatTimeAgocounts 30-day months, which reach 12 five days before a year. It now stays at "11 months ago" until "1 year ago".Known limitations
[deleted]header.kidslists for ids neither Algolia source has, which is left for a follow-up.